package com.buaa.contentProvider;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by Administrator on 2016/4/23.
 */
public class DBHelper extends SQLiteOpenHelper {
    private static String DBNAME="mydb.db";
    private static int VERSION=1;

    public DBHelper(Context context){
        super(context,DBNAME,null,VERSION);
    }

    //ContentProvider实际上是在SQLiteDataBase的基础上对外提供uri，使其他应用可以通过特定的uri访问本应用的数据库

    @Override
    public void onCreate(SQLiteDatabase db) {
      String sql="create table(id int primary key autoincrement,name text,address text)";
       db.execSQL(sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
